package com.gljx.web.controller;

import com.gljx.util.CommonExport;
import com.gljx.util.GetFid;
import com.gljx.util.ImportExecl;
import com.gljx.util.TimeFormat;
import com.gljx.web.Entity.*;
import com.gljx.web.service.CustomLogService;
import com.gljx.web.service.DepartmentService;
import com.gljx.web.service.StudentService;
import com.gljx.web.service.SubjectThreeNoService;
import org.apache.poi.hssf.usermodel.*;
import org.apache.poi.hssf.util.HSSFColor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.BufferedOutputStream;
import java.io.File;
import java.io.IOException;
import java.io.OutputStream;
import java.text.SimpleDateFormat;
import java.util.*;

@Controller
@RequestMapping("/")
public class SubjectThreeNoController {
	// 自动注入
	@Autowired
	private DepartmentService departmentService;

	@Autowired
	private CustomLogService customLogService;
	
	@Autowired
	private SubjectThreeNoService subjectThreeNoService;
	
	@Autowired
	private StudentController studentController;
	
	@Autowired
	private StudentService studentService;
	
	private ImportExecl poi = new ImportExecl();

	
	@RequestMapping(value = "querySubjectThreeNo/look.action")
	public String selSubjectThreeNo(HttpServletRequest request, @RequestParam(value = "fnumber", defaultValue = "") String fnumber
            , @RequestParam(value = "cfstudentname", defaultValue = "") String cfstudentname
            , @RequestParam(value = "beginTime", defaultValue = "") String beginTime
            , @RequestParam(value = "endTime", defaultValue = "")String endTime
			, @RequestParam(value = "type",defaultValue = "") String type
			, @RequestParam(value = "selectState",required = false,defaultValue = "-1") String selectState) throws Exception {
		PageBean<SubjectThreeNo> pb = new PageBean<>();
        //获取操作人信息
        User user = (User) request.getSession().getAttribute("user");
        try {
            fnumber = fnumber.trim();//去空格
            cfstudentname = cfstudentname.trim();
            beginTime=beginTime.trim();
            endTime=endTime.trim();
			if("1".equals(selectState)){//如果传过来的标记为1 所以业务日期为空默认查询全部
				pb=getPageBean(request,user.getFcompanyid(),fnumber,cfstudentname,null,null);
			}else{
				//默认时间
				if ("".equals(beginTime) && "".equals(endTime)) {
					beginTime = TimeFormat.getMonth();
					endTime = TimeFormat.getNowTime();
				}
				//获取分页
				pb=getPageBean(request,user.getFcompanyid(),fnumber,cfstudentname,beginTime,endTime);
			}

            //获取当前分页的值
            List<SubjectThreeNo> subjectThreeNoList = pb.getBeanList();
			//生成信息总数
			String messageAmount="共有"+pb.getTr()+"条信息";
            //返回界面的搜索条件
			request.setAttribute("messageAmount",messageAmount);
            request.setAttribute("fnumber", fnumber);
            request.setAttribute("cfstudentname", cfstudentname);
            request.setAttribute("beginTime", beginTime);
            request.setAttribute("endTime", endTime);
            request.setAttribute("subjectThreeNoList", subjectThreeNoList);
            request.setAttribute("pb", pb);
            request.setAttribute("type",type);
			request.setAttribute("selectState",selectState);
        } catch (Exception e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }      
		return "backHome/examManage/subjectThreeNo/subjectThreeNoList";
	}
	
	/**
	 * 跳转到添加科目三编号页面
	 * @param request
	 * @return
	 * @throws Exception
	 */
	@RequestMapping(value="/intoAddSubjectThreeNo")
	public String intoAddSubjectThreeNo(HttpServletRequest request,String type)throws Exception{
		 User user = (User)request.getSession().getAttribute("user");
		    //获取组织
		    Department department = departmentService.queryAdminByFid(user.getFcompanyid());	    
	        //获取当前时间
		    Calendar now = Calendar.getInstance();
			now.add(Calendar.MONTH, -3);// 月份减1
		    /*获取当前时间*/
	        String createTime = TimeFormat.timeFormat(new Date());
	        Date resultDate = now.getTime(); // 结果     
	        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
	        String beginTime = sdf.format(resultDate);
	        String endTime = sdf.format(new Date());
	        Map map = studentController.getPageAsTrainCharge(request, "", "","0","", "","", beginTime, endTime); //调用学员方法
	        request.setAttribute("beginTime", beginTime);
	        request.setAttribute("endTime", endTime);
	        request.setAttribute("pb", map.get("pb"));
	        request.setAttribute("students", map.get("sList"));	   
	        request.setAttribute("department", department);
	        request.setAttribute("type",type);
			return "backHome/examManage/subjectThreeNo/addSubjectThreeNo";
		
	}
	
	/**
	 * 添加科目三編號
	 * @param request
	 * @param subjectThreeNo
	 * @return
	 * @throws Exception
	 */
	@RequestMapping(value="/addSubjectThreeNo")
	public String addSubjectThreeNo(HttpServletRequest request,SubjectThreeNo subjectThreeNo)throws Exception{
		/*获取uuid*/
        String uuid = GetFid.UUIDIntoFid();
        //获取操作人信息
        User user = (User) request.getSession().getAttribute("user");
        subjectThreeNo.setFid(uuid);
        //公司id
        subjectThreeNo.setCfficompanyid(user.getFcompanyid());
        //控制单元id
        subjectThreeNo.setFcontrolunitid(user.getFcompanyid());
        //获取当前修改时间
        String createTime = TimeFormat.timeFormat(new Date());
        //创建人id
        subjectThreeNo.setFcreatorid(user.getFid());
        //创建时间
        subjectThreeNo.setFcreatetime(createTime);
        //添加
        int row = subjectThreeNoService.addSubjectThreeNo(subjectThreeNo);
        String result ="";
        if(row > 0){
			result ="1";
		}
        //添加日志
        customLogService.addLog("考试管理", TimeFormat.timeFormat(new Date()) + "科目三编号进行添加", null, user.getFid());
		return "redirect:/DrivingSys/intoAddSubjectThreeNo?type="+result;
	}
	
	/**
	 * 跳转到修改科目三编号页面
	 * @param fid
	 * @return
	 * @throws Exception
	 */
	@RequestMapping(value="/intoUpdateSubjectThreeNo")
	public String intoUpdateSubjectThreeNo(HttpServletRequest request,String fid)throws Exception{
		//获取操作人信息
        User user = (User) request.getSession().getAttribute("user");
		//获取组织
	    Department department = departmentService.queryAdminByFid(user.getFcompanyid());	  
	    //获取科目二编号信息
	    SubjectThreeNo subjectThreeNo=subjectThreeNoService.selSubjectThreeNoByFid(fid);
	    Calendar now = Calendar.getInstance();
		now.add(Calendar.MONTH, -3);// 月份减1
	    /*获取当前时间*/
        String createTime = TimeFormat.timeFormat(new Date());
        Date resultDate = now.getTime(); // 结果     
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
        String beginTime = sdf.format(resultDate);
        String endTime = sdf.format(new Date());
        Map map = studentController.getPageAsTrainCharge(request, "", "","0","", "","", beginTime, endTime); //调用学员方法
        request.setAttribute("beginTime", beginTime);
        request.setAttribute("endTime", endTime);
        request.setAttribute("pb", map.get("pb"));
        request.setAttribute("students", map.get("sList"));	
	    request.setAttribute("department", department);
	    request.setAttribute("subjectThreeNo", subjectThreeNo);
		return "backHome/examManage/subjectThreeNo/updateSubjectThreeNo";
	}
	
	/**
	 * 根据fid修改科目三编号信息
	 * @param request
	 * @param subjectThreeNo
	 * @return
	 * @throws Exception
	 */
	@RequestMapping(value="/updateSubjectThreeNo")
	public String updateSujectThreeNo(HttpServletRequest request,SubjectThreeNo subjectThreeNo)throws Exception{
		//获取操作人信息
        User user = (User) request.getSession().getAttribute("user");
        //获取当前修改时间
        String updateTime = TimeFormat.timeFormat(new Date());
        //修改人
        subjectThreeNo.setFlastupdateuserid(user.getFid());
        //修改时间
        subjectThreeNo.setFlastupdatetime(updateTime);
        //修改
        int row =subjectThreeNoService.updateSubjectThreeNoByFid(subjectThreeNo);
        String result ="";
        if(row >0){
        	result="1";
		}
        //添加日志
        customLogService.addLog("考试管理", TimeFormat.timeFormat(new Date()) + "科目三编号进行修改", null, user.getFid());
		return "redirect:/DrivingSys/querySubjectThreeNo/look.action?type="+result;
	}
	
	/**
	 * 根据fid删除科目三编号
	 * @param request
	 * @param deleteId
	 * @param fid
	 * @return
	 * @throws Exception
	 */
	@RequestMapping(value="/deleteSubjectThreeNoByFid")
	public String deleteSubjectThreeNoByFid(HttpServletRequest request, String[] deleteId,String fid)throws Exception{
		User user = (User) request.getSession().getAttribute("user");
        //删除记录
		if(fid==null || fid.equals("")){
			for (int i = 0; i < deleteId.length; i++) {
	            /*过滤为空的删除操作*/
	            if (!deleteId[i].equals("")&&deleteId[i]!=null) {
	            	subjectThreeNoService.deleteSubjectThreeNoByFid(deleteId[i]);
	            }
	        }	
		}else{
			subjectThreeNoService.deleteSubjectThreeNoByFid(fid);
        }
		//添加日志
        customLogService.addLog("考试管理", TimeFormat.timeFormat(new Date()) + "科目三编号进行删除", null, user.getFid());
		return "redirect:/DrivingSys/querySubjectThreeNo/look.action";
	}
	
	/**
	 * 导出EXCLE 科目三编号模板
	 * @return
	 * @throws IOException 
	 */
	@RequestMapping(value="/exportSubjectThreeNoMassExcle")
	public void  exportSubjectThreeNoMassExcle(HttpServletResponse response) throws IOException{
		String fileName = "科目三编号导入模板.xls";  
        fileName = new String(fileName.getBytes("GBK"), "iso8859-1");  
        response.reset();  
        response.setHeader("Content-Disposition", "attachment;filename="  
                + fileName);// 指定下载的文件名  
        response.setContentType("application/vnd.ms-excel");  
        response.setHeader("Pragma", "no-cache");  
        response.setHeader("Cache-Control", "no-cache");  
        response.setDateHeader("Expires", 0);  
        OutputStream output = response.getOutputStream();  
        BufferedOutputStream bufferedOutPut = new BufferedOutputStream(output);  
        HSSFWorkbook wb = new HSSFWorkbook();  
        // 创建单元格样式  
        HSSFCellStyle cellStyleTitle = wb.createCellStyle();  
        // 指定单元格居中对齐  
        cellStyleTitle.setAlignment(HSSFCellStyle.ALIGN_CENTER);  
        // 指定单元格垂直居中对齐  
        cellStyleTitle.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER);  
        // 指定当单元格内容显示不下时自动换行  
        cellStyleTitle.setWrapText(true);  
        cellStyleTitle.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND);
        cellStyleTitle.setFillForegroundColor(HSSFColor.LAVENDER.index);
        // ------------------------------------------------------------------  
        /*HSSFCellStyle cellStyle = wb.createCellStyle();  
        // 指定单元格居中对齐  
        cellStyle.setAlignment(HSSFCellStyle.ALIGN_CENTER);  
        // 指定单元格垂直居中对齐  
        cellStyle.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER);  
        // 指定当单元格内容显示不下时自动换行  
        cellStyle.setWrapText(true);  
        cellStyle.setFillForegroundColor((short)41);*/
        // ------------------------------------------------------------------  
        // 设置单元格字体  
        HSSFFont font = wb.createFont();  
        font.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);  
        font.setFontName("宋体");  
        font.setFontHeight((short) 200);  
        cellStyleTitle.setFont(font);  
       
  
        // 工作表名
        String xuhao = "序号";
        String name = "姓名";  
        String zjhm = "证件号码";
        String zkzmbh = "准考证明编号";
        String yksj = "约考时间";
        String ksdd = "考试地点";
        String kscx = "考试车型";
        String zkcx = "准考车型";
        HSSFSheet sheet = wb.createSheet();  
       /* ExcelExport exportExcel = new ExcelExport(wb, sheet);  */
        // 创建报表头部  
        /*exportExcel.createNormalHead(worksheetTitle, 2);  */
        // 定义第一行  
        HSSFRow row1 = sheet.createRow(0);  
        HSSFCell cell1 = row1.createCell(0);  
  
        //第一行第一列  
          
        cell1.setCellStyle(cellStyleTitle);  
        cell1.setCellValue(new HSSFRichTextString(xuhao));  
        //第一行第er列  
        cell1 = row1.createCell(1);  
        cell1.setCellStyle(cellStyleTitle);  
        cell1.setCellValue(new HSSFRichTextString(name));
        
        //第一行第三列
        cell1 = row1.createCell(2);  
        cell1.setCellStyle(cellStyleTitle);  
        cell1.setCellValue(new HSSFRichTextString(zjhm));
        //第一行第4列
        cell1 = row1.createCell(3);  
        cell1.setCellStyle(cellStyleTitle);  
        cell1.setCellValue(new HSSFRichTextString(zkzmbh));
        //第一行第5列
        cell1 = row1.createCell(4);  
        cell1.setCellStyle(cellStyleTitle);  
        cell1.setCellValue(new HSSFRichTextString(yksj));
        //第一行第6列
        cell1 = row1.createCell(5);  
        cell1.setCellStyle(cellStyleTitle);  
        cell1.setCellValue(new HSSFRichTextString(ksdd));
        //第一行第7列
        cell1 = row1.createCell(6);  
        cell1.setCellStyle(cellStyleTitle);  
        cell1.setCellValue(new HSSFRichTextString(kscx));
        //第一行第8列
        cell1 = row1.createCell(7);  
        cell1.setCellStyle(cellStyleTitle);  
        cell1.setCellValue(new HSSFRichTextString(zkcx));
  
		sheet.setColumnWidth(0,xuhao.getBytes().length*3*256); 
		sheet.setColumnWidth(1,name.getBytes().length*3*256);
		sheet.setColumnWidth(2,zjhm.getBytes().length*3*256); 
		sheet.setColumnWidth(3,zkzmbh.getBytes().length*3*256);
		sheet.setColumnWidth(4,yksj.getBytes().length*3*256); 
		sheet.setColumnWidth(5,ksdd.getBytes().length*3*256);
		sheet.setColumnWidth(6,kscx.getBytes().length*3*256); 
		sheet.setColumnWidth(7,zkcx.getBytes().length*3*256);
        
      /*  //定义第二行  
        HSSFRow row = sheet.createRow(2);  
        HSSFCell cell = row.createCell(1);  */
		try {  
            bufferedOutPut.flush();  
            wb.write(bufferedOutPut);  
            bufferedOutPut.close();  
        } catch (IOException e) {  
            e.printStackTrace();  
            System.out.println("Output   is   closed ");  
        } finally {  
    
        }             
	}
	
	@ResponseBody
	@RequestMapping(value="/uploadSubjectThreeNoMass")
	public Object uploadSubjectThreeNoMass(@RequestParam(value="file",required=false)MultipartFile file,
			HttpServletRequest request,HttpServletResponse response) {
		//获取操作人信息
        User user = (User) request.getSession().getAttribute("user");
        //获取当前修改时间
	    String createTime = TimeFormat.timeFormat(new Date());
		Map<String,List<String>> mapMesg = new HashMap<>();//记录导入信息
		List<String> errorList=new ArrayList<>();//记录错误信息
		List<String> successList=new ArrayList<>();//记录成功信息
		String filesFileName=file.getOriginalFilename();
		try {
			uploadExcel(request,file, filesFileName);// 上传
		} catch (Exception e) {
			e.printStackTrace();
		}
		Map<String, List<StudentImport>> map = new HashMap<>();
		//System.out.println("文件名字: "+request.getServletContext().getRealPath("/")+ "xls" + File.separatorChar + filesFileName);
		//读取
		map=poi.show3(
				request.getServletContext().getRealPath("/")+ "xls" + File.separatorChar + filesFileName
				);
		if(map.size() == 0){//没有可以导入的数据！";
			
			return null;
		}else{
		 List<StudentImport> sList = map.get("1");		
		 for(StudentImport studentImport : sList){			
			 //根据学员身份证号码找出学员信息
			 Student student=studentService.selectStudentByCardidAndName(studentImport.getCerno(), studentImport.getStuName());
             if(student == null){
                 errorList.add(studentImport.getStuName());//记录找不到信息学员
             } else {
                 SubjectThreeNo subjectThreeNo = new SubjectThreeNo();
                 subjectThreeNo.setFid(GetFid.UUIDIntoFid());
                 //控制单元id
                 subjectThreeNo.setFcontrolunitid(user.getFcompanyid());
                 //创建人id
                 subjectThreeNo.setFcreatorid(user.getFid());
                 //创建时间
                 subjectThreeNo.setFcreatetime(createTime);
                 subjectThreeNo.setCfbimudf0001id(student.getFid());
                 subjectThreeNo.setCfxh(studentImport.getXuhao());
                 subjectThreeNo.setCfzjhm(studentImport.getCerno());
                 subjectThreeNo.setCfzkzmbh(studentImport.getZkzNum());
                 subjectThreeNo.setCfykrq(studentImport.getYksj());
                 subjectThreeNo.setCfksdd(studentImport.getKsdd());
                 subjectThreeNo.setCfkskm("科目三");
                 subjectThreeNo.setCfzkcx(studentImport.getZkcx());
                 subjectThreeNoService.addSubjectThreeNo(subjectThreeNo);
                 successList.add(studentImport.getStuName());//成功导入的学员
             }
		 }
		//添加日志
	    customLogService.addLog("考试管理", TimeFormat.timeFormat(new Date()) + "科目三编号进行添加", null, user.getFid());
		}
		mapMesg.put("success", successList);
		mapMesg.put("error", errorList);
		return mapMesg;
	}
	
	
	/**
	 * Excel上传
	 * @param request
	 * @param
	 * @throws Exception
	 */
	public  void uploadExcel(HttpServletRequest request, MultipartFile file,String fileName)throws Exception{
		String path=request.getServletContext().getRealPath("/")+"xls/";
		File fileUpload=new File(path);
		if(!fileUpload.exists()){
			fileUpload.mkdirs();
		}
		file.transferTo(new File(path+fileName));
	}
	
	@SuppressWarnings("unchecked")
    /**
     * 返回PageBean实体类  包括记录总数，页码，每页记录集等  dmz 20160921
     * @return 返回PageBean实体类
     * @throws Exception
     */
    public PageBean<SubjectThreeNo> getPageBean(HttpServletRequest request, String companyId, String fnumber,
            String studentName,String beginTime, String endTime) throws Exception {

        int offset;//从第几条数据开始加载
        if (request.getParameter("pager.offset") == null) {
            offset = 0;
        } else {
            offset = Integer.parseInt(request.getParameter("pager.offset"));
        }
        //拼接SQL语句
        StringBuffer psql = new StringBuffer();
       
        	psql.append("SELECT S.FNUMBER,S.FSIMPLENAME,S.FID,S.FCREATORID,S.FCREATETIME,S.FLASTUPDATEUSERID,S.FLASTUPDATETIME,"+
        				"S.FCONTROLUNITID,S.CFFICOMPANYID,S.CFBIMUDF0001ID,S.CFZJHM,S.CFZKZMBH, to_char(S.CFYKRQ,'YYYY-MM-DD') CFYKRQ,S.CFKSDD,S.CFJXJC,"+
        				"S.CFKSKM,S.CFYKSX,S.CFYWLX,S.CFKSCC,S.CFXH,S.CFLSH,S.CFZKCX,S.FNAME_L1,S.FNAME_L2,S.FNAME_L3,"+
        				"S.FDESCRIPTION_L1,S.FDESCRIPTION_L2,S.FDESCRIPTION_L3, STU.FNAME_L2 AS studentName"+       				        				
        				" FROM CT_DS_SUBJECTTHREENO S LEFT JOIN CT_DS_STUDENT STU ON STU.FID=S.CFBIMUDF0001ID"+
        				" WHERE S.FCONTROLUNITID='"+companyId+"'");
        	if (fnumber == null || fnumber.equals("")) {
				
			} else {
				psql.append( "AND S.CFXH LIKE '%" + fnumber + "%' ");
			}
			if (studentName == null || studentName.equals("")) {
	
			} else {
				psql.append( "AND STU.FNAME_L2 LIKE '%" + studentName + "%'");
			}
			if (beginTime == null || endTime == null) {
			/*	 beginTime = TimeFormat.getMonth();
			} else if(endTime == null || endTime.equals("")){				 	
			        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");			      
			        endTime = sdf.format(new Date());
				psql.append("AND TO_CHAR(S.CFYKRQ,'yyyy-MM-dd') BETWEEN '" + beginTime + "' AND '" + endTime + "'"); */
			}else{
				psql.append("AND TO_CHAR(S.CFYKRQ,'yyyy-MM-dd') BETWEEN '" + beginTime + "' AND '" + endTime + "'"); 
			}
			
			psql.append(" ORDER BY S.CFYKRQ DESC");       
        int psize = 100; //每页显示数
        int pindex = offset / psize;//+1  页码从0开始
        Map<String, Object> paramMap = new HashMap<String, Object>();
        paramMap = subjectThreeNoService.selectPage(pindex, psql.toString(), psize);
        PageBean<SubjectThreeNo> pb = new PageBean<>();
        pb.setPc(pindex); //页码
        Map<String, Object> paramMapCount = getPageBeanCount(psql.toString()); //取记录总数
        pb.setTr((int) paramMapCount.get("Pcount")); //记录总数
        pb.setPs(psize);
        pb.setBeanList((List<SubjectThreeNo>) paramMap.get("v_cur")); //每页数据集
        return pb;
    }
	
	/**
	 * 取记录总数 dmz 20160921
	 * @param psql  SQL语句
	 * @return Map
	 * @throws Exception
	 */
	public Map<String, Object> getPageBeanCount(String psql) throws Exception{

		Map<String, Object> paramMap = new HashMap<String, Object>();
		paramMap=subjectThreeNoService.selectPageCount(psql);
		return paramMap;
	}


	/**
	 * 导出Execl
	 *
	 * @param response
	 */
	@RequestMapping("/importSubjectThreeNo")
	public void importSubjectThreeNo(HttpServletResponse response, HttpServletRequest request,String cfxh,String cfStudentName,String beginTime,String endTime) {
		//获取操作人信息
		User user = (User) request.getSession().getAttribute("user");
		List<Object> data = new ArrayList<>();
		//查询数据
		List<SubjectThreeNo> subjectThreeNos = subjectThreeNoService.selectSubjectThreeNoExcel(cfxh,cfStudentName,beginTime,endTime,user.getFcompanyid());
		for (SubjectThreeNo subjectThreeNo : subjectThreeNos) {
			data.add(subjectThreeNo.getStudentName());//学员
			data.add(subjectThreeNo.getCfxh());//序号
			data.add(subjectThreeNo.getCfzjhm());//证件号码
			data.add(subjectThreeNo.getCfzkzmbh());//准考证编号
			data.add(subjectThreeNo.getCflsh());//流水号
			data.add(subjectThreeNo.getCfykrq());//月考日期
			data.add(subjectThreeNo.getCfksdd());//考试地点
			data.add(subjectThreeNo.getCfjxjc());//驾校简称
			data.add(subjectThreeNo.getCfkskm());//考试科目
			data.add(subjectThreeNo.getCfyksx());//约考顺序
			data.add("");//考试车型
			data.add(subjectThreeNo.getCfkscc());//考试场次
			data.add(subjectThreeNo.getCfzkcx());//准考车型
		}
		//头部数据
		String head[] = {"学员", "序号", "证件号码", "准考证编码", "流水号", "约考日期", "考试地点",
				"驾校简称", "考试科目", "约考顺序" ,"考试车型", "考试场次", "准考车型"};
		//长度
		Integer length[] = {3000, 2000, 6000, 5000, 3000, 5000, 6200, 3000, 2600, 3000, 1500, 1500, 3000};
		try {
			//导出Excel
			CommonExport.importExcel(response, "科目二编码" + TimeFormat.getNowTime2() + ".xls", "科目二编码", data, head, length);
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
}
